import os
import subprocess


def print_log(str):
    print(str)


# 待添加异常处理
def exec_command(arg, config):
    for (i, x) in config[arg.linux_name].items():
        if x["flag"]:
            continue
        for j in x["app"]:
            print_log(i)
            result = subprocess.run(args=j, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
            print_log(result.returncode)
            print_log(result.stdout)
            print_log(result.stderr)
